<template>
  <div>
    <input type="text" v-model="inputKey">
    <button @click="searchUser">搜索</button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name:'SearchUser',
  data() {
    return {
      inputKey:''
    }
  },methods: {
    searchUser(){
      axios.get(`https://api.github.com/search/users?q=${this.inputKey}`).then(
        response => {
          // 请求成功
          this.$bus.$emit('user',response.data)
          console.log(response.data);
        },
        error => {
          console.log(error);
        }
      )
      
    }
  },
}
</script>

<style>

</style>